Skip to content

Conversation

@whummer
Copy link
Member

@whummer whummer commented Jan 25, 2026

Add proxy tests for the CloudWatch service (metrics + logs)

  • Add test file with tests for CloudWatch Metrics and CloudWatch Logs
  • Fix service name mapping (monitoring -> cloudwatch) in auth_proxy and forwarder
  • Use botocore service model for protocol compatibility (LocalStack uses smithy-rpc-v2-cbor, boto3 uses query protocol)
  • Implement resource name matching for CloudWatch and CloudWatch Logs

Tests added:

  • test_cloudwatch_metric_operations: PutMetricData and ListMetrics
  • test_cloudwatch_alarm_operations: PutMetricAlarm and DescribeAlarms
  • test_cloudwatch_readonly_operations (xfail): read-only mode
  • test_cloudwatch_resource_name_matching (xfail): resource pattern matching
  • test_logs_group_operations: CreateLogGroup and DescribeLogGroups
  • test_logs_stream_and_events: log streams and events
  • test_logs_readonly_operations: read-only mode for logs
  • test_logs_resource_name_matching: resource pattern matching for logs
  • test_logs_filter_log_events: FilterLogEvents operation

@whummer whummer changed the title Add cloudwatch proxy tests Add CloudWatch proxy tests Jan 25, 2026
@whummer whummer force-pushed the add-cloudwatch-proxy-tests branch 4 times, most recently from 9d6626b to d3bb061 Compare February 2, 2026 16:51
@whummer whummer marked this pull request as ready for review February 2, 2026 16:58
Copy link
Contributor

@nik-localstack nik-localstack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with two questions:

  • It seems that the agent didn't catch the instructions added about identifying read-only operations as there are for example BatchGetServiceLevelObjectiveBudgetReport or FilterLogEvents. Should we modify the instructions ?

  • Do we want to release a new version of the extension with these changes ?

@whummer
Copy link
Member Author

whummer commented Feb 4, 2026

It seems that the agent didn't catch the instructions added about identifying read-only operations as there are for example BatchGetServiceLevelObjectiveBudgetReport or FilterLogEvents. Should we modify the instructions ?

Great catch - thanks for the detailed review @nik-localstack ! 🙌 This actually still dates back to the time before we extended the AGENT.md instructions (PR has been in draft state for a while), will ask the agent to update/extend the tests based on this. 👍

Do we want to release a new version of the extension with these changes ?

Good point - I have another set of tests and small logic changes coming up in #119, perhaps it could make sense to release a new version once that one is reviewed&merged. 👍

whummer and others added 5 commits February 4, 2026 13:28
- Add test file with tests for CloudWatch Metrics and CloudWatch Logs
- Fix service name mapping (monitoring -> cloudwatch) in auth_proxy and forwarder
- Use botocore service model for protocol compatibility (LocalStack uses smithy-rpc-v2-cbor, boto3 uses query protocol)
- Implement resource name matching for CloudWatch and CloudWatch Logs

Tests added:
- test_cloudwatch_metric_operations: PutMetricData and ListMetrics
- test_cloudwatch_alarm_operations: PutMetricAlarm and DescribeAlarms
- test_cloudwatch_readonly_operations (xfail): read-only mode
- test_cloudwatch_resource_name_matching (xfail): resource pattern matching
- test_logs_group_operations: CreateLogGroup and DescribeLogGroups
- test_logs_stream_and_events: log streams and events
- test_logs_readonly_operations: read-only mode for logs
- test_logs_resource_name_matching: resource pattern matching for logs
- test_logs_filter_log_events: FilterLogEvents operation

Known limitations (2 xfail tests):
- CloudWatch read_only and resource_name_matching: form data stream consumed by LocalStack before proxy can access it (Query protocol issue)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add DELETE endpoint to remove proxies from PROXY_INSTANCES
- Add deregister_from_instance() method in auth_proxy.py
- Update test fixture to deregister proxies during cleanup
- Remove xfail markers from CloudWatch tests that now pass
- Add _reconstruct_request_body for Query protocol services
- Add resource name matching for CloudWatch and CloudWatch Logs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@whummer whummer force-pushed the add-cloudwatch-proxy-tests branch from d3bb061 to dbd3e14 Compare February 4, 2026 12:42
- Add test_logs_readonly_filter_log_events to verify FilterLogEvents works in read_only mode
- Add test_logs_readonly_insights_query to verify StartQuery/GetQueryResults work in read_only mode
- Update AGENTS.md with instruction to avoid time.sleep() in tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants